
<?php

 
class session_manage {
    public function __set($name, $value) {
        $_SESSION[$name] = $value ;
    }
    /*
    public  function __get($name) {
        return $_SESSION[$name];
    }*/
    
   /* public function getSession($name){
        return $_SESSION[$name];
    }*/
    public function __unsetSession($name){
        if(isset($_SESSION[$name]) && !empty($_SESSION[$name])){
            unset($_SESSION[$name]);
        }
        
    }
}

class session_set {
    protected $session ; 
    
    public function __construct() {
        $this->session = new session_manage;
        return $this->session ;
    }
    public function setSession($name,$value){
        $this->session->$name = $value ;
    }
    public function getSession($name){
        return $_SESSION[$name];
   }
    
}
$session = new session_set();
$session->setSession("name","ankit");
echo $session->getSession("name");   

        
        
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
 /*** nullify any existing autoloads ***/
   // define("ROOT","/var/www/domain/application/");
    $module = @$_GET["module"];
    $view = @$_GET["view"];
    
    $modelClass = strtolower($module)."_model" ; 
    $controllerClass = strtolower($module)."_controller";
    $viewClass = strtolower($module)."_view";
    $controllerMethod = strtolower($view)."Controller";
    $viewName = $modelClass.".php";
    spl_autoload_register(null, false);

    /*** specify extensions that may be loaded ***/
    spl_autoload_extensions('.php, .class.php');
    echo '<pre>';

    /*** class Loader ***/
final class AutoLoader {
  public  static final function modelLoader($class1)
    {   
        $modelfile = str_replace("_",DIRECTORY_SEPARATOR ,ROOT.strtolower($class1))."/$class1.php";
        if (!file_exists($modelfile))
        {
           
            print_r(new ErrorException($modelfile .'Not Exists !'));
        } 
        echo " include $modelfile<br/>";
        include $modelfile;
    }
    public  static final function controllerLoader($class2)
    {
        $cFile = str_replace("_",DIRECTORY_SEPARATOR ,ROOT.strtolower($class2))."/$class2.php";
        if (!file_exists($cFile))
        {
           
            echo  new ErrorException($cFile .'Not Exists !');
        } 
        echo " include $cFile<br/>";
        include $cFile;
    }
    public  static final function viewLoader($class3)
    {   
        $classObj = explode("_",$class3);
        $vFile = str_replace("_",DIRECTORY_SEPARATOR ,ROOT.strtolower($class3))."/$classObj[0].php";
        if (!file_exists($vFile))
        {
           //echo $vFile;
            echo  new ErrorException($filename .'Not Exists !');
        } 
        echo " include $vFile";
        include $vFile;
    }
}
    /*** register the loader functions ***/
    //spl_autoload_register(array('AutoLoader','modelLoader'));
    //  spl_autoload_register(null, false);
    spl_autoload_register(array('AutoLoader','controllerLoader'));
    spl_autoload_register(array('AutoLoader','viewLoader'));

    /*** a new blog instance ***/
    //$modelObj = new $modelClass;
    $controllerObj = new $controllerClass; 
    $viewObj = new $viewClass ;
    /*** run the index method ***/
    
    
    
    
    //print_r($acl->getRoll("dataentry"));

?>

